<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>控制样式</title>
    <style>
        .d1{
            border:1px red solid;
            font-size : 50px;
        }
    </style>
</head>
<body>

<div id="div1">
    我爱中国
</div>

<div id="div2">
    我是帅哥
</div>
<script>
    var div1 = document.getElementById("div1");
    div1.onclick = function(){
        div1.style.border = "1px solid #FF00FF";
        //设置一下div的边框样式
        div1.style.fontSize = "100px";
        //遇到font-size这种的要写成这样fontSize
    }

    var div2 = document.getElementById("div2");
    div2.onclick = function(){
         div2.className="d1";
    }
</script>
</body>
</html>